package com.cgnpc.scp.manager.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.cgnpc.cud.core.domain.AjaxResult;
import com.cgnpc.scp.common.mybatis.entity.ScpCommonFileUpload;
import com.cgnpc.scp.common.mybatis.mapper.client.ScpCommonFileUploadMapper;
import com.cgnpc.scp.manager.service.FileCommonService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FileCommonServiceImpl implements FileCommonService {

    @Autowired
    private ScpCommonFileUploadMapper scpCommonFileUploadMapper;

    @Override
    public AjaxResult getFileList() {
        QueryWrapper<ScpCommonFileUpload> queryWrapper = new QueryWrapper<>();
        List<ScpCommonFileUpload> files = scpCommonFileUploadMapper.selectList(queryWrapper);
        return AjaxResult.success().put("data", files);
    }

    @Override
    public AjaxResult getFileInfo(String id) {
        QueryWrapper<ScpCommonFileUpload> queryWrapper = new QueryWrapper<>();
        
        // addCriterion("file_center_file_id =", value, "fileCenterFileId");
        queryWrapper.eq("file_center_file_id", id);

        List<ScpCommonFileUpload> files = scpCommonFileUploadMapper.selectList(queryWrapper);
        return AjaxResult.success().put("data", files);
    }
}
